import request from '@/utils/request'

// 查询列表页接口
export const getOrderDetailPage = (params: any) => {
  return request({
    url: '/order/conditionSearch',
    method: 'get',
    params
  })
}

// 查看接口
export const queryOrderDetailById = (params: any) => {
  return request({
    url: `/order/details/${params.orderId}`,
    method: 'get'
  })
}

//修改完成接口
export const completeOrder = (id: any) => {
  return request({
    url: `/order/complete/${id}`,
    method: 'put'
  })
}

//订单取消
export const orderCancel = (data: any) => {
  return request({
    url: '/order/cancel',
    method: 'put',
    data
  })
}

//接单
export const orderAccept = (data: any) => {
  return request({
    url: '/order/confirm',
    method: 'put',
    data
  })
}

// //拒单
// export const orderReject = (params: any) => {
//   return request({
//     url: '/order/rejection',
//     method: 'put',
//     data: { ...params }
//   })
// }
//
//获取待接单，未完成数量
export const getOrderListBy = (params: any) => {
  return request({
    url: '/order/statistics',
    method: 'get'
  })
}
// 设置自动接单
export const postOrderAutoAccept = (auto:string='2') => {
  return request({
    url: '/order/autoAccept/'+auto,
    method: 'post' ,
  })
}

// 修改订单菜品
export const putOrderDetailUpdateApi = (data) => {
  return request({
    url: '/orderDetail/update',
    method: 'put' ,
    data
  })
}

// 按桌号获取订单列表
export const getOrderPlaceApi = (place:any) => {
  return request({
    url: '/order/place/'+place,
    method: 'get',
  })
}

// 添加订单（加菜）
export const postOrderAddOrderApi = (data) => {
  return request({
    url: '/order/addOrder',
    method: 'post',
    data
  })
}
